package com.etc.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.etc.service.OrderService;

@Controller
public class OrderJsController {
	@Autowired
	private OrderService or;
	@RequestMapping(value="js")
	public String jsOrder(int orderId,String deskName,double orderPrice,Model model,HttpServletRequest request) {
		
		model.addAttribute("orderId", orderId);
		model.addAttribute("deskName", deskName);
		model.addAttribute("orderPrice", orderPrice);
		request.getSession().setAttribute("orderId", orderId);
		request.getSession().setAttribute("deskName", deskName);
		
	
		 return "forward:/index.jsp";
	}
	@RequestMapping(value="require")
	public String doOrderChange(int orderId,String deskName) {
		int a =or.doChangeOrderState(orderId);
		int b=or.doChangeDeskState(1, deskName);
		return "redirect:/order/list";
	}
}
